package org.nox.helloseries.domain;

public class SiteFtp
    implements Comparable<SiteFtp>
{

    private String ip;

    private String port;

    private String login;

    private String password;

    private String folder;

    public SiteFtp()
    {
    }

    public SiteFtp( String ip, String port, String login, String password, String folder )
    {
        super();
        this.ip = ip;
        this.port = port;
        this.login = login;
        this.password = password;
        this.folder = folder;
    }

    public String getIp()
    {
        return ip;
    }

    public void setIp( String ip )
    {
        this.ip = ip;
    }

    public String getPort()
    {
        return port;
    }

    public void setPort( String port )
    {
        this.port = port;
    }

    public String getLogin()
    {
        return login;
    }

    public void setLogin( String login )
    {
        this.login = login;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword( String password )
    {
        this.password = password;
    }

    public String getFolder()
    {
        return folder;
    }

    public void setFolder( String folder )
    {
        this.folder = folder;
    }

    public int compareTo( SiteFtp s )
    {
        int result = ( this.getIp().compareTo( s.getIp() ) );
        if ( result == 0 )
        {
            result = ( this.getPort().compareTo( s.getPort() ) );
            if ( result == 0 )
            {
                result = ( this.getFolder().compareTo( s.getFolder() ) );
            }
        }
        return result;
    }

    public String getPath()
    {
        return getIp() + ":" + getPort() + "/" + getFolder();
    }

    /**
     * @return ftp:// user : password @ host : port / path
     */
    public String getFullPath()
    {
        return "ftp://" + getLogin() + ":" + getPassword() + "@" + getIp() + ":" + getPort();
    }

}
